<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>教师信息</title>
    <base th:href="@{/}"/>
    <th:block th:include="common/common::resource"></th:block>
    <link rel="stylesheet" href="css/mainPage.css">
    <script type="text/javascript" src="js/mainPage.js"></script>
    <script type="text/javascript" src="js/teacherPage.js"></script>

</head>
<body>
    <div>
        <b>名称:</b><input id="filterName" type="text"></input>
        <button type="button" class="btn btn-default btn-sm" onclick="teacherPage.select()">
            <span class="glyphicon glyphicon-zoom-in" aria-hidden="true"></span> 查询
        </button>
        <button type="button" class="btn btn-default btn-sm" onclick="teacherPage.clearQuery()">
            <span class="glyphicon glyphicon-zoom-out" aria-hidden="true"></span> 清空查询
        </button>
        <span class="operationOption">
            <button onclick="teacherPage.add()" type="button" class="btn btn-default btn-sm">
                <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> 新建教师
            </button>
            <button onclick="teacherPage.deleteAll()" type="button" class="btn btn-default btn-sm">
                <span class="glyphicon glyphicon-trash" aria-hidden="true"></span> 批量删除
            </button>
             <a href="teacher/exportAll"  type="button" class="btn btn-default btn-sm">
                <span class="glyphicon glyphicon-log-in" aria-hidden="true"></span> 批量导出
            </a>
             <button onclick="teacherPage.importAll()" type="button" class="btn btn-default btn-sm">
                <span class="glyphicon glyphicon-ok-sign" aria-hidden="true"></span> 批量导入
            </button>
        </span>
    </div>


    <div id="teacherContextFragment">
        <table class="table table-hover">
            <thead>
                <tr>
                    <td><input onclick="teacherPage.selectAll()" type="checkbox"/></td>
                    <td>序号</td>
                    <td>教师名称</td>
                    <td>助记码</td>
                    <td>创建时间</td>
                    <td>操作</td>
                </tr>
            </thead>
            <tbody>
                <th:block th:if="${pageVO.params==null||pageVO.params.size()==0}">
                    <tr>
                        <td align="center" colspan="6">没有查询到任何信息</td>
                    </tr>
                </th:block>
                <th:block th:unless="${pageVO.params==null}">
                    <tr th:each="teacher:${pageVO.params}">
                        <td><input th:value="${teacher.id}" type="checkbox"/></td>
                        <td th:text="${teacher.id}"></td>
                        <td th:text="${teacher.tname}"></td>
                        <td th:text="${teacher.mnemonic_code}"></td>
                        <td th:text="${teacher.create_time}"></td>
                        <td>
                            <span>
                                <button th:onclick="teacherPage.edit('[[${teacher.id}]]')" type="button" class="btn btn-default btn-sm" style="background: orange">
                                     <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> 编辑
                                </button>
                            </span>
                            <span>
                                <button th:onclick="teacherPage.deleteOne('[[${teacher.id}]]')" type="button" class="btn btn-default btn-sm" style="background: red">
                                     <span class="glyphicon glyphicon-trash" aria-hidden="true"></span> 删除
                                </button>
                            </span>
                        </td>
                    </tr>
                </th:block>
            </tbody>
        </table>
        <nav id="nav" aria-label="Page navigation">
            <ul class="pagination">
                <li th:if="${pageVO.page==1} " class="disabled">
                    <a href="javascript:void(0)" aria-label="Previous">
                        <span aria-hidden="true">&laquo;</span>
                    </a>
                </li>
                <li th:unless="${pageVO.page==1}" >
                    <a th:onclick="|teacherPage.limitQuery(${pageVO.page}-1)|" aria-label="Previous">
                        <span aria-hidden="true">&laquo;</span>
                    </a>
                </li>


                <li  th:class="${pageVO.page==index?'active':''}" th:each="index:${#numbers.sequence(pageVO.pageStart,pageVO.pageEnd)}" th:value="${index}">
                    <a th:onclick="|teacherPage.limitQuery(${index})|" th:text="${index}"></a>
                </li>


                <li th:if="${pageVO.page==pageVO.realPage}" class="disabled">
                    <a href="javascript:void(0)" aria-label="Next">
                        <span aria-hidden="true">&raquo;</span>
                    </a>
                </li>
                <li th:unless="${pageVO.page==pageVO.realPage}" >
                    <a th:onclick="|teacherPage.limitQuery(${pageVO.page}+1)|" aria-label="Next">
                        <span aria-hidden="true">&raquo;</span>
                    </a>
                </li>
            </ul>
        </nav>
    </div>
    <!-- Modal -->
    <div class="modal fade" id="teacherModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="label">新建教师</h4>
                </div>
                <div class="teacher-modal-body">

                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button  onclick="teacherPage.commonSubmit()" type="button" class="btn btn-primary">确认</button>
                </div>
            </div>
        </div>
    </div>
    <!--下面这个是teacher页面的内容   由于后端无法利用thymeleaf语法 展示部分碎片  所以 将下面这个部分放置到另一个模板中
            所以这个div中内容改变  另一个模板也需要改变   另一个在teacher/teacherContextTemplate.html中
    -->
</body>
</html>